package com.by.common.bean;

import lombok.Data;

import java.util.HashMap;
import java.util.Map;

@Data
public class PageMap extends HashMap {
    int page = 1; //当前页
    int pageSize = 10;//每页记录数

    public PageMap() {
    }

    public PageMap(Map map) {
        if (null != map) {
            if (map.containsKey("page")) {
                this.page = Integer.parseInt(map.get("page").toString());
            }
            if (map.containsKey("pageSize")) {
                pageSize = Integer.parseInt(map.get("pageSize").toString());
            }
            //将用户原来的参数加入到当前map
            putAll(map);
        }
        //将page pageSize加入到当前map中
        put("page", this.page);
        put("pageSize", this.pageSize);
    }
}
